package com.wgworkshop;

import com.jfinal.core.Controller;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * Created by wlc on 2016/11/30.
 */
public class DemoController extends Controller {
	public void index() {
		ReturnObject json = new ReturnObject();

		json.setIntValue(100);

		json.setFloatValue(123.456F);

		int[] arrayInt = new int[5];
		for (int i = 0; i < 5; i++) {
			arrayInt[i] = 11;
		}
		json.setArrayIntValue(arrayInt);

		json.setStringValue("hello");

		json.setDateValue(new Date());

		List<String> listString = new ArrayList<String>();
		for (int i = 0; i < 5; i++) {
			listString.add("list-value-" + i);
		}
		json.setListStringValue(listString);

		Object o = new Object();
		json.setObjectValue(o);

		renderJson(json);
	}
}
